﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace com.lover.astd.common.model
{
    public class Hero : AsObject
    {
        private int _tong;
        /// <summary>
        /// 统
        /// </summary>
        public int Tong
        {
            get { return _tong; }
            set { _tong = value; }
        }
        private int _yong;
        /// <summary>
        /// 勇
        /// </summary>
        public int Yong
        {
            get { return _yong; }
            set { _yong = value; }
        }
        private int _zhi;
        /// <summary>
        /// 智
        /// </summary>
        public int Zhi
        {
            get { return _zhi; }
            set { _zhi = value; }
        }
        private int _star;
        /// <summary>
        /// 将星
        /// </summary>
        public int Star
        {
            get { return _star; }
            set { _star = value; }
        }
        private int _level;
        /// <summary>
        /// 级别
        /// </summary>
        public int Level
        {
            get { return _level; }
            set { _level = value; }
        }
        private int _shiftLevel;
        /// <summary>
        /// 转生级别
        /// </summary>
        public int ShiftLevel
        {
            get { return _shiftLevel; }
            set { _shiftLevel = value; }
        }
        private int _experience;
        /// <summary>
        /// 当前经验
        /// </summary>
        public int Experience
        {
            get { return _experience; }
            set { _experience = value; }
        }
        private int _trainPositionId;
        /// <summary>
        /// 训练位ID
        /// </summary>
        public int TrainPositionId
        {
            get { return _trainPositionId; }
            set { _trainPositionId = value; }
        }
        public string Desc { get { return String.Format("{0}  {1}级", _name, _level); } }
        public void fillValues(XmlNodeList nodes)
        {
            foreach (XmlNode node in nodes)
            {
                if (node.Name == "generalid") this.Id = Int32.Parse(node.InnerText);
                else if (node.Name == "generalname") this.Name = node.InnerText;
                else if (node.Name == "generallevel") this.Level = Int32.Parse(node.InnerText);
                else if (node.Name == "generalexp") this.Experience = Int32.Parse(node.InnerText);
                else if (node.Name == "trainposid") this.TrainPositionId = Int32.Parse(node.InnerText);
                else if (node.Name == "shiftlv") this.ShiftLevel = Int32.Parse(node.InnerText);
            }
        }
    }
}
